package io.renren.modules.edu.controller;

import io.renren.common.utils.Result;
import io.renren.modules.edu.dto.EChartsDTO;
import io.renren.modules.edu.dto.TEduTeacherinfoDTO;
import io.renren.modules.edu.service.TEduTeacherinfoService;
import io.renren.modules.edu.vo.TEduTeacherinfoVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * 教师信息表
 *
 * @author zwp zwp
 * @since 1.0.0 2022-07-11
 */
@RestController
@RequestMapping("edu/teduteacherinfo")
@Api(tags="教师信息表")
public class TEduTeacherinfoController {

    @Autowired
    private TEduTeacherinfoService tEduTeacherinfoService;

    /**
     * 获取登录的教师信息
     * @param params
     * @return
     */
    @GetMapping("queryTeacherInfo")
    public Result<TEduTeacherinfoVO> queryTeacherInfo(@RequestParam Map<String, Object> params) {
        TEduTeacherinfoVO tEduTeacherinfoVO = tEduTeacherinfoService.queryTeacherInfo(params);
        return new Result<TEduTeacherinfoVO>().ok(tEduTeacherinfoVO);
    }

    /**
     * 录入教师信息
     * @param dto
     * @return
     */
    @PostMapping("onSubmit")
    public Result<Map<String, Object>> onSubmit(@RequestBody TEduTeacherinfoDTO dto) {
        tEduTeacherinfoService.onSubmit(dto);
        return new Result<Map<String, Object>>();
    }

    /**
     * 根据教师职称进行分类
     * @param params
     * @return
     */
    @GetMapping("queryTeacherJob")
    public Result<List<EChartsDTO>> queryTeacherJob(@RequestParam Map<String, Object> params) {
        List<EChartsDTO> eChartsDTOList = tEduTeacherinfoService.queryTeacherJob(params);
        return new Result<List<EChartsDTO>>().ok(eChartsDTOList);
    }

    /**
     * 获取部门概况分类
     * @param params
     * @return
     */
    @GetMapping("queryDepartmentJob")
    public Result<List<EChartsDTO>> queryDepartmentJob(@RequestParam Map<String, Object> params) {
        List<EChartsDTO> eChartsDTOList = tEduTeacherinfoService.queryDepartmentJob(params);
        return new Result<List<EChartsDTO>>().ok(eChartsDTOList);
    }
}
